package org.cycuchy.hp.components.book {
	
	import com.rubenswieringa.book.Page;
	
	import flash.text.TextField;
	import flash.text.TextFormat;

	public class NumeredPage extends BackgroundImagePage {
		
		public function NumeredPage() {
			super();
		}
		
		override protected function childrenCreated ():void {
			this.rawChildren.addChild(pageNumTextField);
			super.childrenCreated();				
		}
		
		private function get pageNumTextField():TextField {
			var textField:TextField = new TextField();
			textField.selectable = false;
			textField.defaultTextFormat = pageNumFormat;
			textField.text = String(this.index);
			textField.x = this.side == Page.LEFT ? 8 : this.width - 18;
			textField.y = this.height - 23;
			return textField;
		}
		
		private var tf:TextFormat;
		
		private function get pageNumFormat():TextFormat {
			if (tf == null) {
				tf = new TextFormat();
				tf.color = 0x0898BE;
				tf.font = "Tahoma";
				tf.size = 8;
			}
			return tf;
		}
			
	}
	
}